home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Visual Basic new SourceCode and Projects / Audio Recorder 2.0 / frmSettings.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-01-18  |  12.0 KB  |  384 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Begin VB.Form frmSettings 
  4.    Caption         =   "Settings"
  5.    ClientHeight    =   4920
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   6855
  9.    LinkTopic       =   "Form1"
  10.    MinButton       =   0   'False
  11.    ScaleHeight     =   4920
  12.    ScaleWidth      =   6855
  13.    StartUpPosition =   1  'CenterOwner
  14.    Begin MSComDlg.CommonDialog CommonDialog2 
  15.       Left            =   2760
  16.       Top             =   4440
  17.       _ExtentX        =   847
  18.       _ExtentY        =   847
  19.       _Version        =   393216
  20.    End
  21.    Begin VB.CommandButton cmdMidi 
  22.       Caption         =   "Choose midi file to record"
  23.       Height          =   375
  24.       Left            =   1920
  25.       TabIndex        =   24
  26.       Top             =   3840
  27.       Width           =   2535
  28.    End
  29.    Begin VB.CommandButton cmdOke 
  30.       Caption         =   "Ok"
  31.       Height          =   375
  32.       Left            =   4800
  33.       TabIndex        =   23
  34.       Top             =   4200
  35.       Width           =   1575
  36.    End
  37.    Begin VB.Frame Frame6 
  38.       Caption         =   "Recoding options"
  39.       Height          =   3495
  40.       Left            =   1920
  41.       TabIndex        =   12
  42.       Top             =   120
  43.       Width           =   4815
  44.       Begin VB.OptionButton optRecordImmediate 
  45.          Caption         =   "Manual recording"
  46.          Height          =   255
  47.          Left            =   240
  48.          TabIndex        =   20
  49.          Top             =   360
  50.          Value           =   -1  'True
  51.          Width           =   2055
  52.       End
  53.       Begin VB.OptionButton optRecordProgrammed 
  54.          Caption         =   "Programmed recording"
  55.          Height          =   255
  56.          Left            =   240
  57.          TabIndex        =   19
  58.          Top             =   720
  59.          Width           =   2055
  60.       End
  61.       Begin VB.Frame frmTimes 
  62.          Caption         =   "Enter times"
  63.          Height          =   1575
  64.          Left            =   2520
  65.          TabIndex        =   16
  66.          Top             =   120
  67.          Visible         =   0   'False
  68.          Width           =   2175
  69.          Begin VB.CommandButton cmdStartTime 
  70.             Caption         =   "Start time"
  71.             Height          =   375
  72.             Left            =   240
  73.             TabIndex        =   18
  74.             Top             =   360
  75.             Width           =   1695
  76.          End
  77.          Begin VB.CommandButton cmdStopTime 
  78.             Caption         =   "Stop time"
  79.             Height          =   375
  80.             Left            =   240
  81.             TabIndex        =   17
  82.             Top             =   960
  83.             Width           =   1695
  84.          End
  85.       End
  86.       Begin VB.Frame frmManualAuto 
  87.          Caption         =   "Saving file"
  88.          Height          =   1695
  89.          Left            =   2520
  90.          TabIndex        =   13
  91.          Top             =   1680
  92.          Visible         =   0   'False
  93.          Width           =   2175
  94.          Begin VB.CommandButton cmdFileName 
  95.             Caption         =   "Filename"
  96.             Height          =   375
  97.             Left            =   360
  98.             TabIndex        =   22
  99.             Top             =   1080
  100.             Width           =   1575
  101.          End
  102.          Begin VB.OptionButton Option10 
  103.             Caption         =   "Manual"
  104.             Height          =   195
  105.             Left            =   240
  106.             TabIndex        =   15
  107.             Top             =   360
  108.             Width           =   1575
  109.          End
  110.          Begin VB.OptionButton Option11 
  111.             Caption         =   "Automatic"
  112.             Height          =   195
  113.             Left            =   240
  114.             TabIndex        =   14
  115.             Top             =   720
  116.             Value           =   -1  'True
  117.             Width           =   1095
  118.          End
  119.       End
  120.       Begin VB.Label lblTimes 
  121.          Caption         =   " "
  122.          Height          =   1215
  123.          Left            =   240
  124.          TabIndex        =   21
  125.          Top             =   1200
  126.          Visible         =   0   'False
  127.          Width           =   2055
  128.       End
  129.    End
  130.    Begin VB.Frame Frame3 
  131.       Caption         =   "Resolution"
  132.       Height          =   1095
  133.       Left            =   120
  134.       TabIndex        =   9
  135.       Top             =   3720
  136.       Width           =   1575
  137.       Begin VB.OptionButton opt8bits 
  138.          Caption         =   "8 bits"
  139.          Height          =   255
  140.          Left            =   360
  141.          TabIndex        =   11
  142.          Top             =   360
  143.          Width           =   855
  144.       End
  145.       Begin VB.OptionButton opt16bits 
  146.          Caption         =   "16 bits"
  147.          Height          =   255
  148.          Left            =   360
  149.          TabIndex        =   10
  150.          Top             =   720
  151.          Width           =   855
  152.       End
  153.    End
  154.    Begin VB.Frame Frame2 
  155.       Caption         =   "Channels"
  156.       Height          =   1095
  157.       Left            =   120
  158.       TabIndex        =   6
  159.       Top             =   2400
  160.       Width           =   1575
  161.       Begin VB.OptionButton optMono 
  162.          Caption         =   "mono"
  163.          Height          =   255
  164.          Left            =   360
  165.          TabIndex        =   8
  166.          Top             =   720
  167.          Width           =   855
  168.       End
  169.       Begin VB.OptionButton optStereo 
  170.          Caption         =   "stereo"
  171.          Height          =   255
  172.          Left            =   360
  173.          TabIndex        =   7
  174.          Top             =   360
  175.          Width           =   855
  176.       End
  177.    End
  178.    Begin VB.Frame Frame1 
  179.       Caption         =   "Sample rate (Hz)"
  180.       Height          =   2055
  181.       Left            =   120
  182.       TabIndex        =   0
  183.       Top             =   120
  184.       Width           =   1575
  185.       Begin VB.OptionButton optRate6000 
  186.          Caption         =   "6000"
  187.          Height          =   315
  188.          Left            =   360
  189.          TabIndex        =   5
  190.          Top             =   1560
  191.          Width           =   1095
  192.       End
  193.       Begin VB.OptionButton optRate8000 
  194.          Caption         =   "8000"
  195.          Height          =   315
  196.          Left            =   360
  197.          TabIndex        =   4
  198.          Top             =   1260
  199.          Width           =   1095
  200.       End
  201.       Begin VB.OptionButton optRate11025 
  202.          Caption         =   "11025"
  203.          Height          =   315
  204.          Left            =   360
  205.          TabIndex        =   3
  206.          Top             =   960
  207.          Width           =   1095
  208.       End
  209.       Begin VB.OptionButton optRate22050 
  210.          Caption         =   "22050"
  211.          Height          =   315
  212.          Left            =   360
  213.          TabIndex        =   2
  214.          Top             =   660
  215.          Width           =   1095
  216.       End
  217.       Begin VB.OptionButton optRate44100 
  218.          Caption         =   "44100"
  219.          Height          =   315
  220.          Left            =   360
  221.          TabIndex        =   1
  222.          Top             =   360
  223.          Width           =   1095
  224.       End
  225.    End
  226. Attribute VB_Name = "frmSettings"
  227. Attribute VB_GlobalNameSpace = False
  228. Attribute VB_Creatable = False
  229. Attribute VB_PredeclaredId = True
  230. Attribute VB_Exposed = False
  231. Option Explicit
  232. Private Sub cmdFileName_Click()
  233.     WaveFileName = InputBox("Filename: ", "Filename for automatic saving", WaveFileName)
  234. End Sub
  235. Private Sub cmdMidi_Click()
  236.     CommonDialog2.CancelError = True
  237.     On Error GoTo ErrHandler1
  238.     CommonDialog2.Filter = "Midi file (*.mid*)|*.mid"
  239.     CommonDialog2.Flags = &H2 Or &H400
  240.     CommonDialog2.ShowOpen
  241.     WaveMidiFileName = CommonDialog2.FileName
  242.     WaveMidiFileName = GetShortName(WaveMidiFileName)
  243. ErrHandler1:
  244. End Sub
  245. Private Sub cmdOke_Click()
  246.     Unload Me
  247. End Sub
  248. Private Sub cmdStartTime_Click()
  249.     Dim wrst As String
  250.     wrst = WaveRecordingStartTime
  251.     wrst = InputBox("Enter start time recording", "Start time", wrst)
  252.     If wrst = "" Then Exit Sub
  253.     If Not IsDate(wrst) Then
  254.         MsgBox ("The date/time you entered was not valid!")
  255.     Else
  256.     ' String returned from InputBox is a valid time,
  257.     ' so store it as a date/time value in WaveRecordingStartTime.
  258.         If CDate(wrst) < Now Then
  259.             MsgBox ("Recording events in the past is not possible...")
  260.             WaveRecordingStartTime = Now + TimeSerial(0, 15, 0)
  261.         Else
  262.             WaveRecordingStartTime = CDate(wrst)
  263.         End If
  264.         If WaveRecordingStopTime < WaveRecordingStartTime Then WaveRecordingStopTime = WaveRecordingStartTime + TimeSerial(0, 15, 0)
  265.     End If
  266. End Sub
  267. Private Sub cmdStopTime_Click()
  268.     Dim wrst As String
  269.     wrst = WaveRecordingStopTime
  270.     If wrst < WaveRecordingStartTime Then wrst = WaveRecordingStartTime + TimeSerial(0, 15, 0)
  271.         
  272.     wrst = InputBox("Enter stop time recording", "Stop time", wrst)
  273.     If wrst = "" Then Exit Sub
  274.     If Not IsDate(wrst) Then
  275.         MsgBox ("The time you entered was not valid!")
  276.     Else
  277.     ' String returned from InputBox is a valid time,
  278.     ' so store it as a date/time value in WaveRecordingStartTime.
  279.         If CDate(wrst) < WaveRecordingStartTime Then
  280.             MsgBox ("The stop time has to be later then the start time!")
  281.             WaveRecordingStopTime = WaveRecordingStartTime + TimeSerial(0, 5, 0)
  282.         Else
  283.             WaveRecordingStopTime = CDate(wrst)
  284.         End If
  285.     End If
  286. End Sub
  287. Private Sub Form_Load()
  288.     Select Case Rate
  289.     Case 44100
  290.         optRate44100.Value = True
  291.     Case 22050
  292.         optRate22050.Value = True
  293.     Case 11025
  294.         optRate11025.Value = True
  295.     Case 8000
  296.         optRate8000.Value = True
  297.     Case 6000
  298.         optRate6000.Value = True
  299.     End Select
  300.     Select Case Channels
  301.     Case 1
  302.         optMono.Value = True
  303.     Case 2
  304.         optStereo.Value = True
  305.     End Select
  306.     Select Case Resolution
  307.     Case 8
  308.         opt8bits.Value = True
  309.     Case 16
  310.         opt16bits.Value = True
  311.     End Select
  312.     If WaveRecordingImmediate Then
  313.         optRecordImmediate.Value = True
  314.     Else
  315.         optRecordProgrammed.Value = True
  316.     End If
  317.     If WaveAutomaticSave Then
  318.         Option11.Value = True
  319.     Else
  320.         Option10.Value = True
  321.     End If
  322.           
  323. End Sub
  324. Private Sub optRate11025_Click()
  325.     Rate = 11025
  326.     optRate11025.Value = True
  327. End Sub
  328. Private Sub optRate44100_Click()
  329.     Rate = 44100
  330.     optRate44100.Value = True
  331. End Sub
  332. Private Sub Option10_Click()
  333.     WaveAutomaticSave = False
  334. End Sub
  335. Private Sub Option11_Click()
  336.     WaveAutomaticSave = True
  337. End Sub
  338. Private Sub optRate22050_Click()
  339.     Rate = 22050
  340.     optRate22050.Value = True
  341. End Sub
  342. Private Sub optRate8000_Click()
  343.     Rate = 8000
  344.     optRate8000.Value = True
  345. End Sub
  346. Private Sub optRate6000_Click()
  347.     Rate = 6000
  348.     optRate6000.Value = True
  349. End Sub
  350. Private Sub optMono_Click()
  351.     Channels = 1
  352.     optMono.Value = True
  353. End Sub
  354. Private Sub optStereo_Click()
  355.     Channels = 2
  356.     optStereo.Value = True
  357. End Sub
  358. Private Sub opt8bits_Click()
  359.     Resolution = 8
  360.     opt8bits.Value = True
  361. End Sub
  362. Private Sub opt16bits_Click()
  363.     Resolution = 16
  364.     opt16bits.Value = True
  365. End Sub
  366. Private Sub optRecordImmediate_Click()
  367.     WaveRecordingImmediate = True
  368.     frmManualAuto.Visible = False
  369.     frmTimes.Visible = False
  370.     lblTimes.Visible = False
  371.     AudioRecorder.cmdRecord.Enabled = True
  372. End Sub
  373. Private Sub optRecordProgrammed_Click()
  374.     WaveRecordingImmediate = False
  375.     frmManualAuto.Visible = True
  376.     frmTimes.Visible = True
  377.     lblTimes.Visible = True
  378.     AudioRecorder.cmdRecord.Enabled = False
  379.     If WaveRecordingStartTime < Now Then
  380.         WaveRecordingStartTime = Now + TimeSerial(0, 15, 0)
  381.         WaveRecordingStopTime = WaveRecordingStartTime + TimeSerial(0, 15, 0)
  382.     End If
  383. End Sub
  384.